#include "LoginLayer.h"


LoginLayer::LoginLayer(void):repeatX(0)
{
}


LoginLayer::~LoginLayer(void)
{
	delete xiong;
	delete paopao;
	CCTextureCache::sharedTextureCache()->removeTextureForKey("login_bg.png");
}

bool LoginLayer::init()
{
	if ( !CCLayer::init() )
	{
		return false;
	}
	 CCTextureCache::sharedTextureCache()->addImage("login_bg.png");
	
	paopao=new XYSprite(456,"2dd87623");
	paopao->setXY(100,480);
	paopao->moveTo(700,480);
	paopao->addToWorld(this);

	xiong=new XYSprite(937,"5dad549b");
	xiong->setXY(300,480);
	xiong->addToWorld(this);
	//delete xiong;

	this->scheduleUpdate();
	return true;
}

void LoginLayer::update(float time){
	
	paopao->update(time);
	xiong->update(time);
}
void LoginLayer::draw(){
	CCTexture2D* bg= CCTextureCache::sharedTextureCache()->textureForKey("login_bg.png");
	int width=bg->getContentSize().width;
	bg->drawAtPoint(ccp(repeatX,0));
	bg->drawAtPoint(ccp(width+repeatX,0));
	repeatX-=0.5;
	if(repeatX<=-800){
		repeatX=0;
	}
}